<template>
    <div class="container" v-if="store.isEnter">
        <div class="add">
            <h3> 事件查询 </h3>
        </div>
        <div class="search">
            <el-input v-model.trim="store.ID" @keydown.enter="search" />
            <div class="btn">
                <el-button type="primary" @click="search">查询</el-button>
                <el-button type="success" @click="clear">清空</el-button>
            </div>
        </div>
        <el-divider />
        <el-table ref="singleTableRef" :data="listInfo" highlight-current-row style="width: 100%" border>
            <el-table-column type="index" width="50" />
            <el-table-column property="id" label="ID" />
            <el-table-column property="name" label="事件名" />
            <el-table-column property="area" label="肇事地区" />
            <el-table-column property="driver" label="驾驶人" />
            <el-table-column property="car_num" label="车牌号" />
        </el-table>
        <el-divider />
        <el-button type="danger" class="closePage" @click="closePage">x</el-button>
    </div>
</template>

<script setup>
import { inject, onMounted } from 'vue';
import { mapStore } from '@/store';
import { searchID } from '@/hooks/searchIDHook';
const { search, listInfo, clear } = searchID()

const store = mapStore()
const closePage = () => {
    store.isEnter = false
}

</script>

<style scoped lang="scss">
.container {
    position: fixed;
    top: 20%;
    left: 30%;
    z-index: 1000;
    border: solid 12px #99999979;
    border-radius: 10px;
    background: #fff;
    width: 600px;
    height: 500px;

    .add {
        height: 50px;
        background: rgba(135, 207, 235, 0.667);

        h3 {
            color: #fff;
            text-align: center;
            line-height: 50px;
        }
    }

    .search {
        display: flex;
        padding: 10px;
        margin: 10px 0px 0px 40px;

        .el-input {
            width: 300px;
        }

        .btn {
            margin-left: 50px;
        }

    }
}

.closePage {
    position: absolute;
    top: 0px;
    right: 0px;
}
</style>
